<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<html>
	<head>	
		<script type="text/javascript" src="<%=contextPath%>/js/validator.js"></script> 
		<script type="text/javascript" language="javascript">  
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				        {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:toCheck,
				            hidden:<%=session.getAttribute("btn_save_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '清空',
				            icon:"<%=contextPath%>/images/refresh-menu.gif",
				            handler:function(){
				            	toReset();
				            }
				        }
			    	]
			    });
			});

				  
			function toCheck(){

			  	if(!Validator.Validate(frmM,2)){
				  return false;
			  	}

				// 要验证的编号
				var password0 = $("#password0").val();

				$.ajax({
					type: "post",
					url : "<%=contextPath%>/user!check.do",
					dataType:'json',
					data: 'password=' + password0,
					success: function(json,state){

						// 通过验证
						if (json.m == undefined) {
							$('#result').html("");
							// 提交
							comt();
						} else {
							$('#result').html("<nobr><font color='red'>" + json.m + "</font></nobr>");
						}
					},
					error:function(json) {
						alert("异步失败！");
					}
				});
  
		    }   

		 </script>  
	</head>
	<body>
		<div id ="tbar"></div>
		<center>
			<!-- 信息提示 -->
			<div result><font color="red">${info }</font></div>
		</center>
		<form id="frmM"   name="frmM" method="POST" >
			<s:hidden name="user.id" />
			<s:hidden name="searchBean.con1" />
			
			<table width="100%" id="infotab">
				<tr>
					<th  width="120" nowrap>
						<font color="red">*</font>&nbsp;当前密码 ：
					</th>
					<td>
						<input type="password" name="password0" id="password0" datatype="Require" maxlength="25" size="50" value="${password}" msg="当前密码必须输入。"/>
						&nbsp;<div id="result"></div>
					</td>
				</tr>
				<tr>
					<th  width="120" >
						<font color="red">*</font>&nbsp;新密码：
					</th>
					<td nowrap>
						<input type="password" datatype="Require" style="ime-mode:disabled;" name="password" id="password" maxlength="25" size="50" msg="新密码必须输入。"/>
					</td>
				</tr>
				
				<tr>
					<th  width="120" >
						<font color="red">*</font>&nbsp;新密码重置：
					</th>
					<td nowrap>
						<input type="password" datatype="Repeat" to="password" name="password2" maxlength="25" size="50" msg="新密码重置必须与新密码一致"/>
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>
<script language="javascript">

	 // 保存
     function comt(){
     	document.frmM.action = "<%=contextPath%>/user!updatePassword.do";
     	document.frmM.submit();
     }
     
     // 返回
     function toReset() {
     	document.frmM.elements["password0"].value="";
		document.frmM.elements["password"].value="";
		document.frmM.elements["password2"].value="";
     }

</script>